﻿using System.Windows.Controls;
namespace LinkShareWpf.ValidationRules
{
  public class RatingValidator : ValidationRule
  {
    public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
    {

        double rating = 0;
        if (value!=null)
            double.TryParse(value.ToString(), out rating);
        if (rating!=0)
            return ValidationResult.ValidResult;
        else
            return new ValidationResult(false, "Occorre impostare un valore di rating");
    }
  }
};